home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / docs / gccfaq10 / modex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-14  |  687 b   |  52 lines

  1. #include "modex.h"
  2. #include <dos.h>
  3.  
  4. void XInit()
  5. {
  6.  union REGS in, out;
  7.  
  8.  /* Call BIOS for mode 0x13 */
  9.  
  10.  in.x.ax = 0x13;
  11.  int86(0x10, &in, &out);
  12.  
  13.  /* Unchain */
  14.  
  15.  outportw(0x3c4, 0x0604);
  16.  outportw(0x3d4, 0xe317);
  17.  outportw(0x3d4, 0x0014);
  18. }
  19.  
  20. void XText()
  21. {
  22.  union REGS in, out;
  23.  
  24.  in.x.ax = 0x3;
  25.  int86(0x10, &in, &out);
  26. }
  27.  
  28. void XPlot(int x, int y, char c)
  29. {
  30.  outportb(0x3c4, 0x2);
  31.  outportb(0x3c5, 1 << (x & 3));
  32.  dosmemput(&c, 1, (X_BYTES * y) + (x / 4) + VIDEO_MEM);
  33. }
  34.  
  35. int main()
  36. {
  37.  int x, y;
  38.  
  39.  XInit();
  40.  
  41.  for (x = 0; x < 256; x++) {
  42.   for (y = 0; y < 100; y++) XPlot(x, y, x);
  43.  }
  44.  
  45.  while (!kbhit());
  46.  getkey();
  47.  
  48.  XText();
  49. }
  50.   
  51.  
  52.